﻿using System;
using FirebirdSql.Data.FirebirdClient;
using Csla;
using System.Collections;
using System.Collections.Generic;
using System.Data;

namespace RMSM
{
    [Serializable()]
    public class TinhTrangHopDongBOList : Csla.NameValueListBase<bool, string>
    {
        #region Factory Methods
        private TinhTrangHopDongBOList()
        {
        }

        public void InsertCustomValue(bool customKey, string customValue)
        {
            IsReadOnly = false;
            this.Insert(0, new NameValuePair(customKey, customValue));
            IsReadOnly = true;
        }

        public void AddCustomValue(bool customKey, string customValue)
        {
            IsReadOnly = false;
            this.Add(new NameValuePair(customKey, customValue));
            IsReadOnly = true;
        }

        public void CleaAll()
        {
            IsReadOnly = false;
            this.ClearItems();
            IsReadOnly = true;
        }

        private static TinhTrangHopDongBOList _list;

        public static TinhTrangHopDongBOList GetTinhTrangHopDongBOList()
        {
            _list = DataPortal.Fetch<TinhTrangHopDongBOList>(null);
            return _list;
        }

        public static void InvalidateCache()
        {
            _list = null;
        }
        #endregion Factory Methods
        //==========================================================================

        #region Data Access
        protected override void DataPortal_Fetch(object _spParam)
        {
            RaiseListChangedEvents = false;
            IsReadOnly = false;
            this.Add(new NameValuePair(true, "Chưa thanh lý"));
            this.Add(new NameValuePair(false, "Đã thanh lý"));
            IsReadOnly = true;
            RaiseListChangedEvents = true;
        }
        #endregion Data Access
        //==========================================================================
    }
}